Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpack the string values from the CL2_.* envs #1145

Merged
merged 1 commit into from
Mar 30, 2020

Conversation

mm4tt
Copy link
Contributor

@mm4tt mm4tt commented Mar 30, 2020

Without doing it, it's impossible to easily override boolean param via env. E.g. if I do

--env=ENABLE_MY_FEATURE=false

The 'false' will be treated as string, and then in the config file the if statement like this:

{{if .ENABLE_MY_FEATURE}}
...
{{end}}

Will evaluate to true and will be executed, because "false" is non-empty string that evaluates to true :)

Without doing it, it's impossible to easily override boolean param via env. E.g. if I do
```
--env=ENABLE_MY_FEATURE=false
```

The `false`  will be treated as string and then in the config file the if statement like this:
```
{{if .ENABLE_MY_FEATURE}}
...
{{end}}
```

Will evaluate to true and will be executed, because "false" is non-empty string that evaluates to true :)
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 30, 2020
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 30, 2020
@@ -240,11 +241,24 @@ func LoadCL2Envs() (map[string]interface{}, error) {
return nil, goerrors.Errorf("unparsable string in os.Eviron(): %v", keyValue)
}
key, value := split[0], split[1]
mapping[key] = value
mapping[key] = unpackStringValue(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure it won't break any existing test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 99% sure as of now.
Currently, we only use this feature in two places: scheduler_throughput and access_tokens. Both are enabled in the presubmit so we'll know for 100% in ~30min

@wojtek-t
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 30, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mm4tt, wojtek-t

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 8caf8ba into kubernetes:master Mar 30, 2020
k8s-ci-robot added a commit that referenced this pull request Jul 17, 2020
Cl2 env template params - backport #1263, #1145, #998 & #921 (release-1.17)
k8s-ci-robot added a commit that referenced this pull request Jul 17, 2020
Cl2 env template params - backport #1263, #1145, #998 & #921 (release-1.16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants